/**
 * 
 */
package de.muyat.kablosuzizci.istemci;

/**
 * Hiz ogelerini tutan bir konteyner sinifi.
 * 
 * @author Dzhoshkun Ismail Shakir
 *
 */
public class Hiz implements Dondurulebilir3f {
	/**
	 * 
	 */
	private float x, y, z;
	
	/**
	 * 
	 */
	@SuppressWarnings("unused")
	private Hiz() {
		
	}

	/**
	 * 
	 * @param x
	 * @param y
	 * @param z
	 */
	public Hiz(float x, float y, float z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	/**
	 * Hizi, verilen {@code ivme}yi {@code sure} boyunca uygulayarak guncelle.
	 * 
	 * @param ivme
	 * @param sure
	 */
	public void guncelle(Ivme ivme, float sure) {
		this.x += ivme.getX() * sure;
		this.y += ivme.getY() * sure;
		this.z += ivme.getZ() * sure;
	}
	
	/**
	 * 
	 * @return
	 */
	public float getX() {
		return x;
	}
	
	/**
	 * 
	 * @return
	 */
	public float getY() {
		return y;
	}
	
	/**
	 * 
	 * @return
	 */
	public float getZ() {
		return z;
	}

	@Override
	public float[] vektorlestir() {
		return new float[]{x, y, z};
	}

	@Override
	public void vektordenKopyala(float[] vektor)
			throws IllegalArgumentException {
		if (vektor.length!=3)
			throw new IllegalArgumentException();
		this.x = vektor[0];
		this.y = vektor[1];
		this.z = vektor[2];
	}
}
